<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@include file="inner/head.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<head>
<link rel="stylesheet" type="text/css" href="${basepath}/res/css/style.css"/>
<script type="text/javascript">
	function login(){
		if(!$("#username").val()){
			jError("请输入用户名", null, function(r){
				$("#username").focus();
			});
			return false;
		}
		else if(!$("#password").val()){
			jError("请输入密码",null, function(r){
				$("#password").focus();
			});
			return false;
		}
		else if(!$("#vcode").val()){
			jError("请输入验证码",null, function(r){
				$("#vcode").focus();
			});
			return false;
		}
		var url="${basepath}/userinfo?m=login";
		var options = {
	  		url:url,
	  		type:'post',
	  		dataType:'json',
	  		success:function(data) {
	    		if(data!=null){
					jError(data.msg);
					document.getElementById("vimg").src="${basepath }/vcode?"+new Date();
				}
				else{
					location.href="${basepath}/main.jsp";
	            }
	  		}
		};
		$("#loginform").ajaxSubmit(options);
	}
</script>
</head>
<body>
  <div id="top"></div>
	<form action="userinfo?m=login" method="post" name="loginform" id="loginform">
  	  <div id="center">
      	<div id="center_left"></div>
      	<div id="center_middle">
      	<div class="user">用户名：<input type="text" name="username" id="username" title="用户名" class="inputbox"/></div>
     	<div class="user">密　码：<input type="password" name="password" id="password" title="密码" class="inputbox"/></div>
      	<div class="chknumber">验证码：<input name="vcode" id="vcode" maxlength="4" class="chknumber_input inputbox" title="验证码" onKeyPress="if(event.keyCode==13)login()"/>&nbsp;&nbsp;<img src="${basepath }/vcode" id="vimg" align="absmiddle" width="60" height="28" title="点击切换验证码" style="cursor: pointer;" onclick="this.src=this.src+'?random=new Date()'"  /></div>
      </div>
      <div id="center_middle_right"></div>
      <div id="center_submit">
        <div class="button"> <img src="${basepath}/res/image/dl.gif" width="57" height="20" onclick="login();" title="登录"> </div>
        <div class="button"> <img src="${basepath}/res/image/cz.gif" width="57" height="20" onclick="loginform.reset();" title="重置"> </div>
      </div>
      <div id="center_right"></div>
    </div>
  </form>
  <div id="footer"></div>
</body>
